// app.js
App({
  // baseUrl: "https://small.andwind.cc/ly_small_24/", //正式环境
  baseUrl: "https://small.andwind.cc/ly_small_24_test/", //测试环境
  videoUrl: "http://qn.andwind.cc/small/",
  onLaunch() {

    const that = this;


    // 获取系统信息
    const systemInfo = wx.getSystemInfoSync();
    // 胶囊按钮位置信息
    const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
    // 导航栏高度 = 状态栏高度 + 44
    that.globalData.navBarHeight = systemInfo.statusBarHeight + 44;
    that.globalData.menuRight = systemInfo.screenWidth - menuButtonInfo.right; 
    that.globalData.menuTop = menuButtonInfo.top;
    that.globalData.menuHeight = menuButtonInfo.height;
    that.globalData.menuBotton = (menuButtonInfo.top - systemInfo.statusBarHeight);
    that.globalData.screenHeight = systemInfo.screenHeight;
    console.log("screenHeight:", that.globalData.screenHeight)
    // 获取手机系统信息 -- 导航高度
    wx.getSystemInfo({
      success: res => {
        //导航高度
        that.globalData.navHeight = res.statusBarHeight + 44;
      },
      fail(err) {
        console.log(err);
      }
    })
  },
  //消息提示
  showTip(msg) {
    wx.showToast({
      icon: 'none',
      title: msg,
      duration: 2000
    });
  },
//滑动渐入渐出
   slideupshow: function (that, param, px, opacity) {
    var animation = wx.createAnimation({
      duration: 800,
      timingFunction: 'ease',
    });

    animation.translateY(px).opacity(opacity).step()
    //将param转换为key
    var json = '{"' + param + '":""}'
    json = JSON.parse(json);
    json[param] = animation.export()
    //设置动画
    that.setData(json)
  },
  //渐入，渐出实现 
  show: function (that, param, opacity) {
    var animation = wx.createAnimation({
      //持续时间800ms
      duration: 800,
      timingFunction: 'ease',
    });
    //var animation = this.animation
    animation.opacity(opacity).step()
    //将param转换为key
    var json = '{"' + param + '":""}'
    json = JSON.parse(json);
    json[param] = animation.export()
    //设置动画
    that.setData(json);

  },
  globalData: {
    navHeight: 0, // 手机导航高度 
    navBarHeight: 0, // 导航栏高度
    menuRight: 0, // 胶囊距右方间距（方保持左、右间距一致）
    menuTop: 0, // 胶囊距底部间距（保持底部间距一致）
    menuHeight: 0, // 胶囊高度（自定义内容可与胶囊高度保证一致）
    menuBotton: 0, // 胶囊距底部间距（保持底部间距一致）
    screenHeight: 0,
    version: '0.0.18', //版本号
    showPrivacyFlag: false //是否已经授权过隐私指引了 false表示需要重新弹出平台协议 true代表不用弹出
  },
})